home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3dm / fx / fxSetupInputImageBuffer.z / fxSetupInputImageBuffer
Encoding:
Text File  |  2002-10-03  |  15.8 KB  |  265 lines

  1.  
  2.  
  3.  
  4. ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppIIIInnnnppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr((((3333ddddmmmm))))                  ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppIIIInnnnppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr((((3333ddddmmmm))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppIIIInnnnppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr, ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppIIIInnnnppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrrWWWWiiiitttthhhhUUUUssssaaaaggggeeee,
  10.      ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppOOOOuuuuttttppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr, ddddmmmmFFFFXXXXCCCClllleeeeaaaannnnuuuuppppIIIInnnnppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr,
  11.      ddddmmmmFFFFXXXXCCCClllleeeeaaaannnnuuuuppppOOOOuuuuttttppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr - manage special-effects image buffers
  12.  
  13.  
  14. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  15.      ####iiiinnnncccclllluuuuddddeeee <<<<ddddmmmmeeeeddddiiiiaaaa////ffffxxxx____bbbbuuuuffffffffeeeerrrr....hhhh>>>>
  16.  
  17.      DDDDMMMMssssttttaaaattttuuuussss ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppIIIInnnnppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr
  18.            (((( DDDDMMMMffffxxxxbbbbuuuuffffffffeeeerrrr**** bbbbuuuuffffffffeeeerrrr ))))
  19.  
  20.      DDDDMMMMssssttttaaaattttuuuussss ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppIIIInnnnppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrrWWWWiiiitttthhhhUUUUssssaaaaggggeeee
  21.            (((( iiiinnnntttt         iiiinnnnppppuuuuttttUUUUssssaaaaggggeeee,,,,
  22.              DDDDMMMMffffxxxxbbbbuuuuffffffffeeeerrrr**** bbbbuuuuffffffffeeeerrrr ))))
  23.  
  24.      DDDDMMMMssssttttaaaattttuuuussss ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppOOOOuuuuttttppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr
  25.            (((( iiiinnnntttt oooouuuuttttppppuuuuttttUUUUssssaaaaggggeeee,,,,
  26.              iiiinnnntttt iiiinnnnppppuuuuttttUUUUssssaaaaggggeeee,,,,
  27.              DDDDMMMMffffxxxxbbbbuuuuffffffffeeeerrrr**** bbbbuuuuffffffffeeeerrrr ))))
  28.  
  29.      DDDDMMMMssssttttaaaattttuuuussss ddddmmmmFFFFXXXXCCCClllleeeeaaaannnnuuuuppppIIIInnnnppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr
  30.            (((( DDDDMMMMffffxxxxbbbbuuuuffffffffeeeerrrr**** bbbbuuuuffffffffeeeerrrr ))))
  31.  
  32.      DDDDMMMMssssttttaaaattttuuuussss ddddmmmmFFFFXXXXCCCClllleeeeaaaannnnuuuuppppOOOOuuuuttttppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr
  33.            (((( DDDDMMMMffffxxxxbbbbuuuuffffffffeeeerrrr**** bbbbuuuuffffffffeeeerrrr ))))
  34.  
  35.  
  36. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
  37.      _b_u_f_f_e_r        a special-effects image buffer, allocated with
  38.                    ddddmmmmFFFFXXXXAAAAllllllllooooccccaaaatttteeeeIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrrssss.
  39.  
  40.      _o_u_t_p_u_t_U_s_a_g_e   Specifies the mode in which the buffer will be used as
  41.                    output; says how the image will be placed into the buffer
  42.                    by a plug-in or application.  The value is one of
  43.                    bbbbuuuuffffOOOOuuuuttttppppuuuuttttDDDDiiiirrrreeeecccctttt, bbbbuuuuffffOOOOuuuuttttppppuuuuttttOOOOppppeeeennnnGGGGLLLL, bbbbuuuuffffOOOOuuuuttttppppuuuuttttmmmmoooovvvviiiieeee.  No more
  44.                    that one can be set.
  45.  
  46.      _i_n_p_u_t_U_s_a_g_e    Specifies the modes in which the buffer will be used as
  47.                    input; says how the image will be read from the buffer and
  48.                    used as input to a plug-in or application.  The value is a
  49.                    bitwise combination of one or more of: bbbbuuuuffffIIIInnnnppppuuuuttttDDDDiiiirrrreeeecccctttt,
  50.                    bbbbuuuuffffIIIInnnnppppuuuuttttTTTTeeeexxxxttttuuuurrrreeee, bbbbuuuuffffIIIInnnnppppuuuuttttDDDDrrrraaaawwwwPPPPiiiixxxxeeeellllssss, bbbbuuuuffffIIIInnnnppppuuuuttttMMMMoooovvvviiiieeee.  The
  51.                    options set must include all of the different ways in which
  52.                    this specific image will be used.
  53.  
  54.  
  55. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  56.      These functions are used to prepare buffers before calling an image
  57.      processing plugin, and clean up after calling a plugin.
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppIIIInnnnppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr((((3333ddddmmmm))))                  ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppIIIInnnnppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr((((3333ddddmmmm))))
  71.  
  72.  
  73.  
  74.      Image buffers for special effects require special handling because they
  75.      must support efficient access to OpenGL and image
  76.      compression/decompression.  Because of this, they may reside in memory
  77.      that is shared with the graphics and compression device drivers.  Setting
  78.      up a buffer before calling a plugin may involve cache flushing and image
  79.      reformatting.  Similarly, after a plugin is called, cleanup may involve
  80.      restoring cache coherency and reformatting the image.
  81.  
  82.      Every use of an image buffer must be preceeded by a setup call, and
  83.      succeeded by a cleanup call.
  84.  
  85.      If an image buffer is to be used as input to a plugin,
  86.      ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppIIIInnnnppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr should be called before calling the plugin, and
  87.      ddddmmmmFFFFXXXXCCCClllleeeeaaaannnnuuuuppppIIIInnnnppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr should be called after the plugin has
  88.      finished.
  89.  
  90.      If an image buffer is to be used to store the output of a plugin,
  91.      ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppOOOOuuuuttttppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr should be called before the plugin is invoked,
  92.      and ddddmmmmFFFFXXXXCCCClllleeeeaaaannnnuuuuppppOOOOuuuuttttppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr should be called afterward.
  93.  
  94.      Usage bits must be supplied to ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppOOOOuuuuttttppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr that specify
  95.      both how the image will be generated (output usage)  and how it will
  96.      later be used (input usage).  The input usage must be specified at this
  97.      point so that the format of the data in the buffer will match the way it
  98.      will be used.  If an application does not know how a buffer will be used,
  99.      it can use bbbbuuuuffffIIIInnnnppppuuuuttttAAAAllllllll as the input usage, but this may impair
  100.      performance.
  101.  
  102.      It is acceptable to always use bbbbuuuuffffIIIInnnnppppuuuuttttAAAAllllllll when specifying input usage,
  103.      but doing so may slow things down.  If your application does not have the
  104.      input usage available when calling ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppOOOOuuuuttttppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr, you can
  105.      give it bbbbuuuuffffIIIInnnnppppuuuuttttAAAAllllllll.  If the input usage is known later, at the time when
  106.      the buffer is set up for input, ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppIIIInnnnppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrrWWWWiiiitttthhhhUUUUssssaaaaggggeeee may be
  107.      used.  This will enable the some optimizations, but may not be as
  108.      efficient as specifying the input usage when the buffer is set up for
  109.      output.
  110.  
  111.      If an application needs to read or write the contents of an image buffer
  112.      directly, it should treat itself as a plugin that uses direct access.
  113.      For example, to place an image in a buffer, call
  114.      ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppOOOOuuuuttttppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr with bbbbuuuuffffOOOOuuuuttttppppuuuuttttDDDDiiiirrrreeeecccctttt, use
  115.      ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppSSSSccccaaaannnnlllliiiinnnneeeeBBBBuuuuffffffffeeeerrrr to get a pointer to the buffer, store the pixels,
  116.      and finally call ddddmmmmFFFFXXXXCCCClllleeeeaaaannnnuuuuppppOOOOuuuuttttppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr.
  117.  
  118.      Normally, calling ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppOOOOuuuuttttppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr will discard any previous
  119.      contents of the buffer.  In one case, though, the contents of the buffer
  120.      are guaranteed to be preserved: if a buffer has been set up for direct
  121.      input, setting it up for direct output will preserve the contents of the
  122.      buffer.
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppIIIInnnnppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr((((3333ddddmmmm))))                  ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppIIIInnnnppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr((((3333ddddmmmm))))
  137.  
  138.  
  139.  
  140. RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEESSSS
  141.      All of these functions return DDDDMMMM____FFFFAAAAIIIILLLLUUUURRRREEEE if anything goes wrong, and
  142.      DDDDMMMM____SSSSUUUUCCCCCCCCEEEESSSSSSSS if successful.  In the case of failure, error information can
  143.      be obtained from ddddmmmmGGGGeeeettttEEEErrrrrrrroooorrrr((((3333ddddmmmm)))).
  144.  
  145.  
  146. EEEEXXXXAAAAMMMMPPPPLLLLEEEE
  147.      This example stores an image in a buffer, processes it through an image
  148.      filter, and the retrieves the result:
  149.  
  150.          DMplugin* filter = ...;
  151.          DMfxbuffer* inputBuffer  = ...;
  152.          DMfxbuffer* outputBuffer = ...;
  153.          PRX_ScanlineBuffer sbuf;
  154.  
  155.          /* Store a black image in the first buffer.  (It's */
  156.          /* being used here as an output buffer to store */
  157.          /* the original image.) */
  158.          if ( dmFXSetupOutputImageBuffer( inputBuffer,
  159.               bufOutputDirect, pmGetSourceAUsage( filter ) )
  160.               != DM_SUCCESS )
  161.          {
  162.               /* ... handle error */
  163.          }
  164.          if ( dmFXSetupScanlineBuffer( inputBuffer, &sbuf )
  165.               != DM_SUCCESS )
  166.          {
  167.               /* ... handle error */
  168.          }
  169.          /* ... store the image.  At this point, sbuf.data */
  170.          /* holds a pointer to the image buffer. */
  171.          if ( dmFXCleanupOutputImageBuffer( inputBuffer )n
  172.               != DM_SUCCESS )
  173.          {
  174.               /* ... handle error */
  175.          }
  176.  
  177.          /* Execute the plug-in. */
  178.          if ( dmFXSetupInputImageBuffer( inputBuffer )
  179.               != DM_SUCCESS )
  180.          {
  181.               /* ... handle error */
  182.          }
  183.          if ( dmFXSetupOutputImageBuffer( outputBuffer,
  184.               pmGetDestUsage(filter), bufInputDirect )
  185.               != DM_SUCCESS )
  186.          {
  187.               /* ... handle error */
  188.          }
  189.          if ( pmBufferExecuteVideoFilter( filter,
  190.               inputBuffer, outputBuffer, 0, 1 )
  191.               != DM_SUCCESS )
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppIIIInnnnppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr((((3333ddddmmmm))))                  ddddmmmmFFFFXXXXSSSSeeeettttuuuuppppIIIInnnnppppuuuuttttIIIImmmmaaaaggggeeeeBBBBuuuuffffffffeeeerrrr((((3333ddddmmmm))))
  203.  
  204.  
  205.  
  206.          {
  207.               /* ... handle error */
  208.          }
  209.          if ( dmFXCleanupInputImageBuffer( inputBuffer )n
  210.               != DM_SUCCESS )
  211.          {
  212.               /* ... handle error */
  213.          }
  214.          if ( dmFXCleanupOutputImageBuffer( outputBuffer )n
  215.               != DM_SUCCESS )
  216.          {
  217.               /* ... handle error */
  218.          }
  219.  
  220.          /* Now we want to get the image */
  221.          if ( dmFXSetupInputImageBuffer( outputBuffer )
  222.               != DM_SUCCESS )
  223.          {
  224.               /* ... handle error */
  225.          }
  226.          if ( dmFXSetupScanlineBuffer( outputBuffer, &sbuf )
  227.               != DM_SUCCESS )
  228.          {
  229.               /* ... handle error */
  230.          }
  231.          /* ... read the image.  At this point, sbuf.data */
  232.          /* holds a pointer to the image buffer. */
  233.          if ( dmFXCleanupInputImageBuffer( outputBuffer )n
  234.               != DM_SUCCESS )
  235.          {
  236.               /* ... handle error */
  237.          }
  238.  
  239.  
  240. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  241.      dmFXAllocateImageBuffers(3dm), dmFXMovieRenderImage(3dm),
  242.      dmFXSetupScanlineBuffer(3dm), dmGetError(3dm).
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.